﻿#include "shaomingwyjbqk_09.h"
#include "ui_shaomingwyjbqk_09.h"

#include<QtSql>
#include<QtGui>
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlTableModel>
#include <QSqlError>

#include <QLineEdit>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QFileDialog>
#include <QTextEdit>
#include <QTextStream>
#include <QTableWidget>
#include <QXmlStreamWriter>


shaomingwyjbqk_09::shaomingwyjbqk_09(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::shaomingwyjbqk_09)
{
    ui->setupUi(this);
    QSqlQuery query;

    //合计
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE NationID!='01'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE NationID!='01' AND RankID='111'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE NationID!='01' AND  RankID='112'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE NationID!='01' AND RankID='121'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE NationID!='01' AND  RankID='122'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  RankID='131'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE NationID!='01' AND   RankID='132'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND RankID='141'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  RankID='142'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  RankID='150'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  RankID='160'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,1,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  RankID='199'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,1,new QTableWidgetItem(text ));

    }



//女公务员


    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'");//女公务员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='111'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='112'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='121'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='122'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='131'");
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='132'");//县处级副职
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='141'");//乡科正职
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='142'");//乡科副职
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='150'");//科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='160'");//办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,2,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND Sex='0'and RankID='199'");//试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,2,new QTableWidgetItem(text ));

    }



//    //少数民族公务员
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01'");//少数民族公务员
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(0,3,new QTableWidgetItem(text ));

//    }
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE NationID!='01' and RankID='121'");//少民厅局正
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(1,3,new QTableWidgetItem(text ));

//    }

//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' and RankID='122'");//少民厅局副
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(2,3,new QTableWidgetItem(text ));

//    }
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' and RankID='131'");//少民县处正
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(3,3,new QTableWidgetItem(text ));

//    }
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' and RankID='132'");//少民县处副
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(4,3,new QTableWidgetItem(text ));

//    }
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' and RankID='141'");//少民乡科正
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(5,3,new QTableWidgetItem(text ));

//    }
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' and RankID='142'");//少民乡科副
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(6,3,new QTableWidgetItem(text ));

//    }
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' and RankID='150'");//少民科员
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(7,3,new QTableWidgetItem(text ));

//    }
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' and RankID='160'");//少民办事员
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(8,3,new QTableWidgetItem(text ));

//    }
//    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' and RankID='199'");//少民试用期
//    if(query.next()){
//        QString text = query.value(0).toString();
//        ui->tableWidget->setItem(9,3,new QTableWidgetItem(text ));

//    }



//中共党员



    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE   NationID!='01' AND  PoliticID='01'");//党员公务员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,3,new QTableWidgetItem(text ));

    }

    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE   NationID!='01' AND  PoliticID='01' and RankID='111'");//少民厅局正
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,3,new QTableWidgetItem(text ));

    }

    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  PoliticID='01' and RankID='112'");//女少民厅局副
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,3,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE   NationID!='01' AND  PoliticID='01' and RankID='121'");//少民厅局正
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,3,new QTableWidgetItem(text ));

    }

    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  PoliticID='01' and RankID='122'");//女少民厅局副
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,3,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  PoliticID='01' and RankID='131'");//女少民县处正
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,3,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE   NationID!='01' AND PoliticID='01' and RankID='132'");//女少民县处副
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,3,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  PoliticID='01' and RankID='141'");//女少民乡科正
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,3,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  PoliticID='01' and RankID='142'");//女少民乡科副
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,3,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  PoliticID='01' and RankID='150'");//女少民科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,3,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  PoliticID='01' and RankID='160'");//女少民办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,3,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM CadreInfo WHERE  NationID!='01' AND  PoliticID='01' and RankID='199'");//党员试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,3,new QTableWidgetItem(text ));

    }


    //博士
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND( AcademicDe='2' or AcademicDe like '2__') ");//博士学位1
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,4,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2' or AcademicDe like '2__')  and RankID='111'");//博士正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,4,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum AND (AcademicDe='2' or AcademicDe like '2__' ) and RankID='112'");//博士副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,4,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2' or AcademicDe like '2__')  and RankID='121'");//博士正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,4,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum AND (AcademicDe='2' or AcademicDe like '2__')  and RankID='122'");//博士副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,4,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2' or AcademicDe like '2__')  and RankID='131'");//博士正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,4,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2'  or AcademicDe like '2__') and RankID='132'");//博士副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,4,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2' or AcademicDe like '2__')  and RankID='141'");//博士正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,4,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2' or AcademicDe like '2__' ) and RankID='142'");//博士副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,4,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2' or AcademicDe like '2__')  and RankID='150'");//博士科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,4,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2' or AcademicDe like '2__')  and RankID='160'");//博士办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,4,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='2' or AcademicDe like '2__')  and RankID='199'");//博士试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,4,new QTableWidgetItem(text ));
    }


//硕士

    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE NationID!='01' AND   Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__') ");//硕士学位3
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,5,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__' ) and RankID='111'");//硕士正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,5,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__' ) and RankID='112'");//硕士副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,5,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__')  and RankID='121'");//硕士正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,5,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND( AcademicDe='3' or AcademicDe like '3__')  and RankID='122'");//硕士副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,5,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__')  and RankID='131'");//硕士正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,5,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__')  and RankID='132'");//硕士副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,5,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND( AcademicDe='3' or AcademicDe like '3__' ) and RankID='141'");//硕士正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,5,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__')  and RankID='142'");//硕士副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,5,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__')  and RankID='150'");//硕士科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,5,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__')  and RankID='160'");//硕士办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,5,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='3' or AcademicDe like '3__')  and RankID='199'");//硕士试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,5,new QTableWidgetItem(text ));
    }


    //学士
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__') ");//学士学位3
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,6,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='111'");//学士正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,6,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='112'");//学士副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,6,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='121'");//学士正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,6,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='122'");//学士副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,6,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4'  or AcademicDe like '4__') and RankID='131'");//学士正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,6,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='132'");//学士副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,6,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='141'");//学士正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,6,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='142'");//学士副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,6,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='150'");//学士科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,6,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='160'");//学士办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,6,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (AcademicDe='4' or AcademicDe like '4__')  and RankID='199'");//学士试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,6,new QTableWidgetItem(text ));
    }

    //非领导职务
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='111' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='112' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')  ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='121' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='122' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')  ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND   Post.RankID='131' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='132' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='141' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='142' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='150' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='160' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='199' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,7,new QTableWidgetItem(text));
    }

    //研究生

    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11')");//研究生学位
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,8,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='111'");//研究生正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,8,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='112'");//研究生副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,8,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='121'");//研究生正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,8,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='122'");//研究生副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,8,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='131'");//研究生正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,8,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='132'");//研究生副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,8,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='141'");//研究生正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,8,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='142'");//研究生副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,8,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='150'");//研究生科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,8,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='160'");//研究生办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,8,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='17' or EduName='14' or EduName='11') and RankID='199'");//研究生试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,8,new QTableWidgetItem(text ));
    }


   //大学本科

    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28')");//研究生学位
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,9,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='111'");//研究生正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,9,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='112'");//研究生副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,9,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='121'");//研究生正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,9,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='122'");//研究生副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,9,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='131'");//研究生正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,9,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='132'");//研究生副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,9,new QTableWidgetItem(text ));

    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='141'");//研究生正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,9,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='142'");//研究生副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,9,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE   NationID!='01' AND Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='150'");//研究生科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,9,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='160'");//研究生办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,9,new QTableWidgetItem(text ));
    }
    query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND (EduName='21' or EduName='28') and RankID='199'");//研究生试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,9,new QTableWidgetItem(text ));
    }


    //大学专科

     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31' ");//大专
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(0,10,new QTableWidgetItem(text ));

     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='111'");//大专正厅
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(1,10,new QTableWidgetItem(text ));

     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'and RankID='112'");//大专副厅
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(2,10,new QTableWidgetItem(text ));

     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='121'");//大专正厅
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(3,10,new QTableWidgetItem(text ));

     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'and RankID='122'");//大专副厅
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(4,10,new QTableWidgetItem(text ));

     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='131'");//大专正处
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(5,10,new QTableWidgetItem(text ));

     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='132'");//大专副处
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(6,10,new QTableWidgetItem(text ));

     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='141'");//大专正科
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(7,10,new QTableWidgetItem(text ));
     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='142'");//大专副科
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(8,10,new QTableWidgetItem(text ));
     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='150'");//大专科员
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(9,10,new QTableWidgetItem(text ));
     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='160'");//大专办事员
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(10,10,new QTableWidgetItem(text ));
     }
     query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName='31'  and RankID='199'");//大专试用期
     if(query.next()){
         QString text = query.value(0).toString();
         ui->tableWidget->setItem(11,10,new QTableWidgetItem(text ));
     }

     //中专及以下

      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39' ");//中专
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(0,11,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='111'");//中专正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(1,11,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39' and RankID='112'");//中专副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(2,11,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='121'");//中专正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(3,11,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39' and RankID='122'");//中专副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(4,11,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='131'");//中专正处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(5,11,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='132'");//中专副处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(6,11,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE NationID!='01' AND   Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='141'");//中专正科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(7,11,new QTableWidgetItem(text ));
      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='142'");//中专副科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(8,11,new QTableWidgetItem(text ));
      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='150'");//中专科员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(9,11,new QTableWidgetItem(text ));
      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='160'");//中专办事员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(10,11,new QTableWidgetItem(text ));
      }
      query.exec("SELECT COUNT(1) FROM Edu,CadreInfo WHERE  NationID!='01' AND  Edu.IDnum=CadreInfo.IDnum  AND EduName>'39'  and RankID='199'");//中专试用期
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(11,11,new QTableWidgetItem(text ));
      }



      //任职期限两年以下
      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//任职期限
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(0,12,new QTableWidgetItem(text ));
      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='111' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(1,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='112' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(2,12,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='121' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(3,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='122' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(4,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='131' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下正处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(5,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='132' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下副处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(6,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='141' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下正科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(7,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='142' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下副科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(8,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='150' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下科员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(9,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='160' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下办事员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(10,12,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='199' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 ");//两年以下试用期
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(11,12,new QTableWidgetItem(text ));

      }


      //任职期限2-5年
      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5");//任职期限
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(0,13,new QTableWidgetItem(text ));
      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='111' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(1,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='112' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(2,13,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='121' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(3,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='122' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(4,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='131' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 ");//两年以下正处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(5,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='132' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5");//两年以下副处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(6,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='141' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 ");//两年以下正科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(7,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='142' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 ");//两年以下副科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(8,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='150' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 ");//两年以下科员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(9,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='160' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5");//两年以下办事员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(10,13,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='199' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5");//两年以下试用期
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(11,13,new QTableWidgetItem(text ));

      }


      //任职期限5-10年

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10");//任职期限
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(0,14,new QTableWidgetItem(text ));
      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='111' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(1,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='112' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(2,14,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='121' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(3,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='122' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(4,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='131' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 ");//两年以下正处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(5,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='132' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10");//两年以下副处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(6,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='141' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 ");//两年以下正科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(7,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='142' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 ");//两年以下副科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(8,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='150' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 ");//两年以下科员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(9,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='160' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10");//两年以下办事员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(10,14,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='199' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10");//两年以下试用期
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(11,14,new QTableWidgetItem(text ));

      }

      //任职期限10-15年
      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15");//任职期限
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(0,15,new QTableWidgetItem(text ));
      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='111' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(1,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='112' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(2,15,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='121' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(3,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='122' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(4,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='131' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 ");//两年以下正处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(5,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='132' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15");//两年以下副处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(6,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='141' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 ");//两年以下正科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(7,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='142' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 ");//两年以下副科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(8,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='150' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 ");//两年以下科员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(9,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='160' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15");//两年以下办事员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(10,15,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='199' and NationID!='01' AND TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15");//两年以下试用期
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(11,15,new QTableWidgetItem(text ));

      }
      //任职期限十五年以上
      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//任职期限
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(0,16,new QTableWidgetItem(text ));
      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='111' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(1,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='112' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(2,16,new QTableWidgetItem(text ));

      }
      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='121' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下正厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(3,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='122' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下副厅
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(4,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='131' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下正处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(5,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='132' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下副处
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(6,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='141' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下正科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(7,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='142' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下副科
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(8,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='150' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下科员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(9,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='160' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下办事员
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(10,16,new QTableWidgetItem(text ));

      }

      query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum AND Post.RankID='199' and NationID!='01' AND  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 ");//两年以下试用期
      if(query.next()){
          QString text = query.value(0).toString();
          ui->tableWidget->setItem(11,16,new QTableWidgetItem(text ));

      }









}


shaomingwyjbqk_09::~shaomingwyjbqk_09()
{
    delete ui;
}

void shaomingwyjbqk_09::on_pushButton_clicked()
{

    QString filepath = QFileDialog::getSaveFileName(this, tr("Save as xml"),QString(), "XML files (*.xml);;");
    if (filepath.isEmpty()) {
        return;
    }
    filepath += ".xml";

    QFile file(filepath);
    if (!file.open(QFile::WriteOnly | QIODevice::Text)) {
        return;
    }

    QXmlStreamWriter writer(&file);
    writer.setAutoFormatting(true);
    writer.writeStartDocument();//版本号，默认1.0
    writer.writeStartElement("少数民族公务员基本情况");
    int row = ui->tableWidget->rowCount();
    int col = ui->tableWidget->columnCount();
    for(int i = 0; i < row; i++)
    {
        //构造行号
        QString row_tmp = "row";
        QString row_tmp1;
        row_tmp1.setNum(i);
        row_tmp.append(row_tmp1);
        writer.writeStartElement("line");
        for(int j = 0; j < col; j++)
        {
            //构造列号
            QString col_tmp = "col";
            QString col_tmp1;
            col_tmp1.setNum(j);
            col_tmp.append(col_tmp1);
            //合成具体位置信息
            QString loc_tmp;
            loc_tmp.append(row_tmp);
            loc_tmp.append(col_tmp);
            QTableWidgetItem *w = ui->tableWidget->item(i,j);
            QString val = w->text();
            writer.writeTextElement(loc_tmp, val);
        }
        writer.writeEndElement();
    }
    writer.writeEndElement();
    writer.writeEndDocument();
    file.close();
}
